﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Hyt.Web.Mvc.Controls
{
    public class Inputs
    {
        /// <summary>
        /// 查找带回
        /// </summary>
        /// <param name="name">PostbackName</param>
        /// <param name="url">查找地址</param>
        /// <param name="remoteget">带回解析式(Postback项),eg:o.Id</param>
        /// <param name="viewremoteget">带回解析式(显示项),eg:o.Id</param>
        /// <returns></returns>
        public static String Remoteback(string name,string url, string remoteget, string viewremoteget,string width="250px",string defaultvalue="",string defaultviewvalue="")
        {
            var guid="X"+Guid.NewGuid().ToString("D");
            string str = String.Format("<div style=\"{4}\">"+
                                            "<input type=\"text\" class=\"input\" autocomplete=\"off\" value=\"{7}\" readonly=\"readonly\" remoteget=\"{2}\" remotegroup=\"{3}\"  remoteback=\"{5}\"  />"+
                                            "<input type=\"hidden\" name=\"{0}\" class=\"input\" autocomplete=\"off\" value=\"{6}\" readonly=\"readonly\"  remoteget=\"{1}\"  remotegroup=\"{3}\"/>"+
                                            "<img class=\"remotereset\" remotegroup=\"{3}\" src=\"/Resources/project/images/icons/decline.png\" style=\"display:none\" />"+
                                       "</div>", name, remoteget, viewremoteget, guid, width, "{url:'" + url + "'}", defaultvalue, defaultviewvalue);
            return str;
        }


    }
}
